import React from 'react';
import { NavLink } from '@pare/micro';
import { Layout, Menu } from 'antd';
import Routes from '@/app/config/routers/index';

const { Header, Content, Footer } = Layout;

class RootComponent extends React.Component {
  setTitle() {
    console.log(this.props);
  }
  render() {
    return (
      <Layout className="layout">
        <Header>
          <div
            className="logo"
            style={{ width: 150, height: 31, background: 'rgba(255, 255, 255, 0.2)', margin: '16px 24px 16px 0', float: 'left' }}
          />
          <Menu theme="dark" mode="horizontal" defaultSelectedKeys={['1']} style={{ lineHeight: '64px' }}>
            <Menu.Item key="1">
              <NavLink to="/">首页</NavLink>
            </Menu.Item>
            <Menu.Item key="2">
              <NavLink to="/demo1">Demo1</NavLink>
            </Menu.Item>
            <Menu.Item key="3">
              <NavLink to="/demo2">子应用</NavLink>
            </Menu.Item>
            <Menu.Item key="4">
              <NavLink to="/demo3">Demo3</NavLink>
            </Menu.Item>
          </Menu>
        </Header>
        <Content>
          <Routes {...this.props} setTitle={this.setTitle} />
        </Content>
        <Footer style={{ textAlign: 'center' }}>平安不动产 ©2020</Footer>
      </Layout>
    );
  }
}

export default RootComponent;
